/*Diego Lima de Freitas RA: 317632
 *Yuri Souza Padua RA: 317420
 * 
 * Classe que trata um ou mais comandos
 */

package AST;

import java.util.ArrayList;

public class CompositeCommand extends Command {

    //private StatementList statementList;
    private ArrayList<Command> commandList;

    public CompositeCommand(ArrayList<Command> commandList) {
        this.commandList = commandList;
    }

    public ArrayList<Command> getStatementList() {
        return commandList;
    }

    @Override
    public void genC(PW pw) {
        pw.println("{");
        if (commandList != null) {
            pw.add();
            for (int i = 0; i < commandList.size(); i++) {
                commandList.get(i).genC(pw);
            }
            pw.sub();
        }
        pw.println("}");
    }
}
